# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/19 下午5:11
 @Author  : tgy
 
"""

from operator import attrgetter

class Person:

    __slots__ = ['_name','_age']

    def __init__(self, name, age):
        ...
        self._name = name
        self._age = age

    def get_name(self):
        return self._name

    def __str__(self):
        return 'per[name={name},age={age}]'.format(name=self._name,age=self._age)

    def __repr__(self):
        return str(self)

def test01():
    ...
    pers = [Person('tony',21),Person('Mac',24)]
    pers.sort(key=attrgetter('_age','_name'))
    print(pers)
    print(Person('tony', 21))


if __name__ == '__main__':
    ...
    test01()
    nums = [1,2,3]
    print(tuple(map(lambda x: x ** 2, nums)))